<script setup lang="ts">
import { inject, ref, type Ref } from 'vue';


const totalCount=inject<Ref<number>>('totalCount',ref(0))
const updateTotalCount=inject('updateTotalCount',(num:number)=>{})
</script>


<template>
  <div class="sonson">
  <h3>后代{{ totalCount }}</h3>
  <button @click="totalCount++">后代修改</button>
  <button @click="updateTotalCount(10)">调用函数</button>
</div>
</template>


<style scoped>
.sonson{
  border: 1px solid rgb(243, 11, 208);
}
</style>